package check.util;


import check.entity.OrderEntity;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class HandleParamCheckUtil {

    List<HandParamFunction> nodes = new ArrayList<>();

    public void handCheck(List<OrderEntity> excel, List<OrderEntity> errorlist) {
        for (HandParamFunction node : nodes) {
            node.handleFilter(excel, errorlist);
            if (excel == null) {
                return;
            }
        }
    }

    public interface HandParamFunction {
        void handleFilter(List<OrderEntity> excel, List<OrderEntity>errorlist);
    }

    HandParamFunction handPoundNo = (excelList,errorList) ->{
        List<OrderEntity> collect = excelList.stream().filter(excel -> excel.getPoundNo1() == null).collect(Collectors.toList());
        if (collect != null) {
            excelList.removeAll(collect);
            errorList.addAll(collect);
        }
    };



}
